//
//  RootViewController.m
//  HGY
//
//  Created by lanou3g on 15/10/27.
//  Copyright (c) 2015年 顾成辉. All rights reserved.
//

#import "RootViewController.h"
#import "FirstViewController.h"
#import "MenuViewController.h"
#import "ThirdViewController.h"
#import "FourViewController.h"

@interface RootViewController ()

@end


@implementation RootViewController

- (void)viewDidLoad {          
    [super viewDidLoad];
    [self addTabBarView];
}

- (void)addTabBarView
{
   
    [self addViewControllerClass:[MenuViewController class] title:@"美食" imageName:@"food" selectImageName:@""];
    
    [self addViewControllerClass:[FirstViewController class] title:@"分类" imageName:@"Fruits" selectImageName:@""];
    [self addViewControllerClass:[ThirdViewController class] title:@"视频" imageName:@"Video" selectImageName:@""];
    
    [self addViewControllerClass:[FourViewController class] title:@"我的" imageName:@"MyMy" selectImageName:@""];
    
    // 更改tabbar字体大小
    self.tabBar.tintColor = [UIColor redColor];
    self.selectedIndex = 0;
    self.tabBar.backgroundColor = [UIColor whiteColor];
}

- (void)addViewControllerClass:(Class)class title:(NSString *)title imageName:(NSString *)imageName selectImageName:(NSString *)selectImageName
{
    UIViewController *viewVC = [[class alloc] init];
    UINavigationController *navC = [[UINavigationController alloc] initWithRootViewController:viewVC];
    [navC.navigationBar setBackgroundImage:[UIImage imageNamed:@"bar_02.jpg"] forBarMetrics:(UIBarMetricsDefault)];
    navC.tabBarItem.title = title;
    navC.tabBarItem.image = [[UIImage imageNamed:imageName]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    
    
    [self addChildViewController:navC];
}

@end
